home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8865 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.halcyon.com!usenet
  2. From: george potts <solvris@halcyon.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Newbie question: byte order
  5. Date: Wed, 06 Mar 1996 11:42:02 -0800
  6. Organization: Solveris Inc
  7. Message-ID: <313DEA8A.665E@halcyon.com>
  8. References: <4hdhjl$m22@nnrp1.news.primenet.com>
  9. NNTP-Posting-Host: blv-pm2-ip24.halcyon.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Dineh Alliance wrote:
  16. > I have found Turbo C++ a good package for developing data conversion routines,
  17. > but recently I encountered a data concept not covered in their online
  18. > documentation (or at least I can't find it):
  19. > byte order (i.e. "bigendian" vs. "littleendian").
  20. > What is it?  Are there any good books or Web/Gopher resources that discuss it?
  21. > Thanks in advance for your help!
  22. > Mark Cederholm
  23.  
  24. byte order refers to the way binary data, such as integers, are 
  25. stored in memory. as i recall, IBM uses bigendian and DEC and 
  26. Intel use littleendian. to convert from one system to the other 
  27. you reverse the order of the bytes.
  28. if you have programmed with sockets you should have used htons, 
  29. htonl, ntohs, ntohl. these functions essentially do the 
  30. conversion from the (h)ost to (n)etwork and vice-versa. this 
  31. causes binary data over the network to be consistent.
  32.  
  33. george
  34.